package com.jwaoo.mobile.view.explore.model;
import android.content.Context;
import com.dx.as.common.ILoadListener;
import com.jwaoo.mobile.db.DBHelper;
import com.jwaoo.mobile.http.HttpHelper;
import com.jwaoo.mobile.view.explore.bean.UserBean;
import java.util.List;
import java.util.Map;

import http.IHttpListener;

/**
 * Created by jwaoo on 2017/8/12.
 */

public class UserModel extends IHttpListener {

    public UserModel(Context context, ILoadListener loadListener) {
        super(context, loadListener);
    }
    private Map param;
    public void getNearByList(Map map) {
        DBHelper.getNearByList(context,this);
        param = map;
    }

    @Override
    public void onResponse(Object response, int flg) {
        if (flg == DBHelper.flg_db){
            HttpHelper.getNearbyList(this,param);
        }
        loadListener.onResponse(response,0);
    }

    @Override
    public void onFailure(Throwable t) {
        loadListener.onFailure(t);
    }

    @Override
    public void onFilure(int code, String errorMsg) {
        super.onFilure(code, errorMsg);
        loadListener.onFailure(code,errorMsg);
    }
}
